The present invention relates to an apparatus for, and a method of, determining whether or not a program violates a convention. Specifically, the present invention relates to an apparatus for, and a method of, determining whether or not a program violates a convention by use of an abstract syntax tree indicating a structure of the program.
In development of a program, there is a case where a convention, such as a method of using the API, is set up in order to enhance the operational efficiency and maintainability. For the purpose of determining whether or not the program violates this convention, the following technique has been heretofore used (see “Rational Code Review” “codereview.lexma.ibm.com”, for example). In the case of this technique, a pattern of an abstract syntax tree indicating a structure of a program violating the convention is beforehand prepared, and thus the pattern is compared with an abstract syntax tree of a program to be an object of a determination.
However, programs to be developed are various in type, and structures respectively violating conventions are also various in type. This makes it extremely difficult to beforehand prepare all the abstract syntax trees respectively indicating structures of programs violating conventions. In addition, a false detection, a failure in detection, and the like are prone to be caused. Moreover, a technique has been proposed, with which a defect in a program is detected without use of an abstract syntax tree (see “FindBugs”, “findbups.sourceforpe.net” for example). In the case of this technique, a control flow and a data flow are analyzed by scanning byte codes of the Java language or the like. Subsequently, parts incapable of being executed in the program are detected, and a user is informed of the parts. In the case of this technique, however, specialized knowledge is needed for implementing a process for analyzing the control flow and the like. As a result, this technique makes it possible to detect only a defect which a specialist in the program language has beforehand expected, and makes it impossible for a person in charge of the project to add or modify a convention depending on the necessity.